//*********************************************************
//
//    Copyright (c) Microsoft. All rights reserved.
//    This code is licensed under the Apache License, Version 2.0.
//    THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
//    ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
//    IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
//    PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Microsoft.Research.ScientificWorkflow.SecurityControls
{
    /// <summary>
    /// Interaction logic for Window1.xaml
    /// </summary>
    public partial class SecurityPolicyView : Window
    {

        /// <summary>
        /// Gets the presentation model.
        /// </summary>
        /// <value>The presentation model.</value>
        SecurityPolicyPresenter PresentationModel
        {
            get
            {
                return this.DataContext as SecurityPolicyPresenter;
            }
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="SecurityPolicyView"/> class.
        /// </summary>
        public SecurityPolicyView()
        {
            InitializeComponent();
            this.brdrHeader.MouseLeftButtonDown += delegate(object sender, MouseButtonEventArgs e) { this.DragMove(); };
        }

        /// <summary>
        /// Handles the SelectionChanged event of the adminList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void adminList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.PresentationModel.RemoveAdministratorCommand.RaiseCanExecuteChanged();
        }

        /// <summary>
        /// Handles the SelectionChanged event of the userList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void userList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.PresentationModel.RemoveUserCommand.RaiseCanExecuteChanged();
        }

        /// <summary>
        /// Handles the SelectionChanged event of the guestList control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.Controls.SelectionChangedEventArgs"/> instance containing the event data.</param>
        private void guestList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            this.PresentationModel.RemoveGuestCommand.RaiseCanExecuteChanged();
        }
    }
}
